<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台管理</title>
    <link rel="stylesheet" href="../layui/css/layui.css" th:href="@{/layui/css/layui.css}">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" style="background-color: white;">
        <div class="layui-logo" style="background-color: black;">后台管理</div>
        <span th:text="${session.user.id}" style="opacity: 0;" id="userid"></span>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img class="layui-nav-img" src="../img/face.png" th:src="@{'/img/'+${session.user.head}}">
                    <span th:text="${session.user.username}" style="color: black" id="username">请登录</span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:;" id="myInfo">个人中心</a></dd>
                    <dd><a href="/Ticket/home/loginOut" id="loginOut">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll" id="test1">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">主页</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../templates/adminHome.html" th:href="@{/templates/adminHome.html}" target="ifr">控制台</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-nav-tree"  lay-filter="test" th:if="${session.user.type}==1">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">数据管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../templates/userInfo.html" th:href="@{/templates/userInfo.html}" target="ifr">用户管理</a></dd>
                        <dd><a href="../templates/carInfo.html" th:href="@{/templates/carInfo.html}" target="ifr">车辆管理</a></dd>
                        <dd><a href="../templates/trainNumInfo.html" th:href="@{/templates/trainNumInfo.html}" target="ifr">车次管理</a></dd>
                        <dd><a href="../templates/ticketLogInfo.html" th:href="@{/templates/ticketLogInfo.html}" target="ifr">记录管理</a></dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">订票系统</a>
                    <dl class="layui-nav-child">
                        <dd><a href="../templates/payTicket.html" th:href="@{/templates/payTicket.html}" target="ifr">车票购买</a></dd>
                        <dd><a href="../templates/ticketSel.html" th:href="@{/templates/ticketSel.html}" target="ifr">已购车票</a></dd>
                        <dd><a href="../templates/myInfo.html" th:href="@{/templates/myInfo.html}" id="my111" target="ifr">个人中心</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <iframe src="adminHome.html" th:src="@{/templates/adminHome.html}" style="width: 100%;height: 98%;" name="ifr" id="ifr"></iframe>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        <div style="margin: 0px;">© 计算机学院11703060219@cqut.com</div>
    </div>
</div>
<script src="../layui/layui.js" th:src="@{/layui/layui.js}"></script>
<script src="../js/index.js" th:src="@{/js/index.js}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

        //获取hash来切换选项卡，假设当前地址的hash为lay-id对应的值
        var layid = location.hash.replace(/^#test1=/, '');
        element.tabChange('test1', layid); //假设当前地址为：http://a.com#test1=222，那么选项卡会自动切换到“发送消息”这一项

        //监听Tab切换，以改变地址hash值
        element.on('tab(test1)', function(){
            location.hash = 'test1='+ this.getAttribute('lay-id');
        });
    });
</script>

</body>
</html>